package com.fengze.business.service.impl;

import java.math.BigDecimal;
import java.util.List;

import com.fengze.common.annotation.AutoSetInsertValue;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.fengze.business.mapper.PerformancePlanMapper;
import com.fengze.business.domain.PerformancePlan;
import com.fengze.business.service.IPerformancePlanService;

/**
 * 合同履约计划Service业务层处理
 * 
 * @author lug
 * @date 2024-02-04
 */
@Service
public class PerformancePlanServiceImpl implements IPerformancePlanService 
{
    @Autowired
    private PerformancePlanMapper performancePlanMapper;

    /**
     * 查询合同履约计划
     * 
     * @param id 合同履约计划主键
     * @return 合同履约计划
     */
    @Override
    public PerformancePlan selectPerformancePlanById(Long id)
    {
        return performancePlanMapper.selectPerformancePlanById(id);
    }

    /**
     * 查询合同履约计划列表
     * 
     * @param performancePlan 合同履约计划
     * @return 合同履约计划
     */
    @Override
    public List<PerformancePlan> selectPerformancePlanList(PerformancePlan performancePlan)
    {
        return performancePlanMapper.selectPerformancePlanList(performancePlan);
    }

    /**
     * 新增合同履约计划
     * 
     * @param performancePlan 合同履约计划
     * @return 结果
     */
    @AutoSetInsertValue
    @Override
    public int insertPerformancePlan(PerformancePlan performancePlan)
    {
        performancePlan.setStatus(0);
        performancePlan.setActualPerformanceAmount(new BigDecimal(0));
        return performancePlanMapper.insertPerformancePlan(performancePlan);
    }

    /**
     * 修改合同履约计划
     * 
     * @param performancePlan 合同履约计划
     * @return 结果
     */
    @Override
    public int updatePerformancePlan(PerformancePlan performancePlan)
    {
        return performancePlanMapper.updatePerformancePlan(performancePlan);
    }

    /**
     * 批量删除合同履约计划
     * 
     * @param ids 需要删除的合同履约计划主键
     * @return 结果
     */
    @Override
    public int deletePerformancePlanByIds(Long[] ids)
    {
        return performancePlanMapper.deletePerformancePlanByIds(ids);
    }

    /**
     * 删除合同履约计划信息
     * 
     * @param id 合同履约计划主键
     * @return 结果
     */
    @Override
    public int deletePerformancePlanById(Long id)
    {
        return performancePlanMapper.deletePerformancePlanById(id);
    }
}
